#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <sstream>

struct mdate
{
    std::string date;
    int msec;
};

bool cmp(mdate a, mdate b)
{
    if (a.date < b.date)
    {
        return true;
    }
    else if (a.msec < b.msec)
    {
        return true;
    }
    else
    {
        return false;
    }
}

int main()
{
    int num = 0;
    std::cin >> num;
    std::cin.ignore();

    std::vector<mdate> orders(num);

    for (int i = 0; i < num; i++)
    {
        std::string time_str;
        std::getline(std::cin, time_str);
        int idx = time_str.find('.');

        orders[i].date = time_str.substr(0, idx);
        orders[i].msec = std::stoi(time_str.substr(idx + 1));
    }

    std::sort(orders.begin(), orders.end(), cmp);

    for (int i = 0; i < num; i++)
    {
        std::cout << orders[i].date << " " << orders[i].msec << std::endl;
    }

    int i = 0;
    int count = 1;
    while (i < num - 1)
    {
        bool repeat = true;
        while ((orders[i].date == orders[i + 1].date))
        {
            if (repeat && (orders[i].msec == orders[i + 1].msec))
            {
                count++;
                i++;
            }
            else
            {
                repeat = false;
                i++;
            }
            if (i >= num - 1)
            {
                break;
            }
        }
        if (i >= num - 1)
            break;
        else
        {
            count++;
            i++;
        }
    }

    std::cout << count << std::endl;
    return 0;
}